Oracle 21C 21.3.0.0 DB for OEL9.4

1 背景知识

本章主要介绍如何在 Oracle Linux 8.6 上安装 Oracle 21C 数据库。

2 操作系统准备

2.1 执行操作系统优化

#root>
bash optimize_system_conf_oracle.sh

2.2 创建目录

#root>
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:dba /u01/app/oracle
chmod -R 775 /u01/app/oracle

2.3 DNS 解析设置

#root>
cat >> /etc/hosts << EOF
192.168.10.190 node1
EOF

2.4 系统依赖包

Note

其他Linux 操作系统。

#root>
yum install -y  binutils elfutils-libelf elfutils-libelf-devel  glibc \
glibc-common  glibc-devel gcc gcc-c++ libaio libgcc  libstdc++ libstdc++-devel \
make sysstat unixODBC-devel libaio-devel lrzsz compat-libstdc libcap.so.1 \
compat-libcap1 compat-libstdc++*  lrzsz oracleasm* libXext* unzip  \
gcc elfutils-libelf-devel gcc-c++

Note

Oracle Linux 操作系统。

#root>
yum install -y oracle-rdbms-server-11gR2-preinstall.x86_64
yum install unzip  gcc elfutils-libelf-devel gcc-c++

2.5  调整/dev/shm

  1. 增大 tmpfs 文件系统大小。
#root>
cat >> /etc/fstab << EOF
tmpfs                   /dev/shm                tmpfs   defaults,size=8192M        0 0
EOF
  1. 重新挂载 tmpfs 文件系统。
#root>
mount -o remount /dev/shm

2.6 设置环境变量

su - oracle
#oracle>
cat >> ~/.bash_profile << EOF
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=citdb
export ORACLE_UNQNAME=citdb
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:
export CVUQDISK_GRP=dba
export DISPLAY=192.168.10.130:0.0
EOF

3 准备安装介质

3.1 创建目录

# root>
cd /app
mkdir setup
mkdir db
chown -R oracle:dba db/

3.2 上传并解压软件

上传以下软件到 setup 目录,并解压到 $ORACLE_HOME

p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
p13390677_112040_Linux-x86-64_3of7.zip
# root>
chown oracle:dba /app/setup
# oracle>
cd /app/setup
 unzip -q p13390677_112040_Linux-x86-64_1of7.zip 
 unzip -q p13390677_112040_Linux-x86-64_2of7.zip
Note

到此为止请打快照 DB_INSTALL_ENV

4 启动数据库安装

cd /app/setup/database
export DISPLAY=192.168.10.130:0.0
./runInstaller

5 安装信息

5.1 Oracle软件安装参数

参数
support eamil 不勾选
Oracle support skip software updates
install option install database sofware only
instal type single intall datadatbase
language 添加simplified chinese
数据库版本 企业版
oracle base /u01/app/oracle
软件安装目录 /u01/app/oracle/product/11.2.0/db_1
inventory /u01/app/oracle/oraInventory
inventory权限组 dba
OSDBA dba
OSOPER oper
ignor all 勾选
执行orainstRoot.sh
执行root.sh
Warning

链接和编译文件的时候会出现一个bug 安装时有出现一个错误:

Error in invoking target 'agent nmhs' of makefile '/u01/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk'

据说是Oracle的一个Bug,在新版系统下可能会表现出来.

解决方案: 保留安装过程,另外开启一个终端窗口,将ins_emagent.mk文件中的 $(MK_EMAGENT_NMECTL) 更改为 $(MK_EMAGENT_NMECTL) -lnnz11,然后在安装过程中点击Retry即可。

5.2 Oracle数据库安装参数

export DISPLAY=192.168.10.130:0.0
dbca
选项 参数
数据库类型 选择GTP
Global Database Name citdb
EM 不勾选
自动维护工具 开启
system 和sys 密码 oracle
数据文件存储 File SYSEM
SFRA (快速恢复区) 4182 (默认)
sample schemas 勾选
SGA and PGA 选择TYpical 并指定 80%。
Process 150
字符集 AL16UTF16
Connection mode 独占模式

6 配置开机自启

6.1 dbstart 文件配置

#oracle>
vi $ORACLE_HOME/bin/dbstart
#oracle>
ORACLE_HOME_LISTNER=/u01/app/oracle/product/11.2.0/db_1

6.2 /etc/oratab 文件配置

dbca 建库时都会自动创建/etc/oratab文件,将 N 修改为 Y

vi /etc/oratab
orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

6.3 /etc/rc.d/rc.local 配置

编辑 /etc/rc.d/rc.local 启动文件,并添加监听启动命令和 dbstart 启动脚本。

#root>
vi /etc/rc.d/rc.local
#!/bin/bash
# 2. THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# 3. It is highly advisable to create own systemd services or udev rules
# 4. to run scripts during boot instead of using this file.
#
# 5. In contrast to previous versions due to parallel execution during boot
# 6. this script will NOT be run after all other services.
#
# 7. Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# 8. that this script will be executed during boot.

touch /var/lock/subsys/local
su -  oracle -lc "/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start"
su -  oracle -lc /u01/app/oracle/product/11.2.0/db_1/bin/dbstart

rc.local 文件中添加可执行权限。

#root>
chmod +x /etc/rc.local

Oracle 开机自启动启动

7 后续其他操作

7.1 导入测试数据

导入 [[000-inbox/Oracle/inito.sql]] 脚本,生成 oa 模式。

7.2 密码过期处理

7.2.1 查看用户 Profile

SELECT username,PROFILE FROM dba_users WHERE username IN ('SYSTEM','OA');

7.2.2 更改 profile 策略

设置 profile 策略

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

更多内容请参考 Oracle 密码过期策略

8 小结 & FAQ

8.1 操作系统不兼容

  1. 报错信息。
[WARNING] [INS-08101] Unexpected error while executing the action at state: 'supportedOSCheck'
CAUSE: No additional information available.
 ACTION: Contact Oracle Support Services or refer to the software manual.
  1. 设置操作系统兼容模式
export CV_ASSUME_DISTID=RHEL7.6
export CV_ASSUME_DISTID=RHEL7.6